<?php 
require dirname(__FILE__).'/../Image.php';
$image = new Image(array(
	'savedir' => '/tmp/upload/',
	'quality' => 40,
	'watermark' => array(
		'minWidth' 	=> 400,
		'minHeight' => 400,
		'path' => '/tmp/watermark.png',
		'right' => 10,  // 水印右边距
		'bottom' => 40, // 水印底边距
	),
	'rules' => array(
		'pic4' => array(
			'width' => 300,
			'height'=> 300,
			'type'	=> 'fill'
		),
		'editor' => array(
			'width' => 650,
			'height' => null,
			'type' => 'thumb',
			'watermark' => true,
		),
	),
));

//$imageId = $image->save('/tmp/upload/test.jpg');
$arr = array('', '1');
foreach($arr as $key) {
	$imageId = $image->save('/tmp/upload/test/hunsha'.$key.'.jpg');
	$url = $image->resizeByRuleName($imageId, 'editor', true);
	var_dump($imageId, $url);
}

//var_dump($image->parseUrl('thumb/462/766/46276698104409285512-650X.jpg'));
//var_dump($image->parseUrl('thumb/612/184/61218456074427653653-650X.jpg'));

?>
